//
//  B_InComeViewController.m
//  DreamOf
//
//  Created by 薛小刚 on 2018/8/24.
//  Copyright © 2018年 薛小刚. All rights reserved.
//

#import "B_InComeViewController.h"
#import "B_BalanceListTVC.h"

@interface B_InComeViewController ()
@property (nonatomic, strong) BaseTableView * mainView;

@end

@implementation B_InComeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view = self.mainView;
    // Do any additional setup after loading the view.
}


- (BaseTableView *)mainView {
    if (!_mainView) {
        _mainView = [[BaseTableView alloc] init];
        [_mainView setTableViewFrameWithTop:5 left:0 right:0 bottom:0];
        [_mainView.tableView registerNib:[UINib nibWithNibName:@"B_BalanceListTVC" bundle:nil] forCellReuseIdentifier:@"B_BalanceListTVC"];
        _mainView.numberOfRowsBlock = ^NSInteger(UITableView *tableView, NSInteger section) {
            return 10;
        };
        _mainView.heightForRowBlock = ^CGFloat(UITableView *tableView, NSIndexPath *indexPath) {
            return 74;
        };
        _mainView.cellForRowBlock = ^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
            B_BalanceListTVC * cell = [tableView dequeueReusableCellWithIdentifier:@"B_BalanceListTVC" forIndexPath:indexPath];
            cell.B_titleLabel.text = @"参与活动【插画也是艺术】";
            cell.B_timeLabel.text = @"2018-8-19 19:30:03";
            
            cell.B_moneyLabel.text = [NSString stringWithFormat:@"%@%@", indexPath.row / 2 == 0 ? @"+" : @"-", @"4444"];
            if (indexPath.row / 2 == 0) {
                cell.B_moneyLabel.textColor = [UIColor color_text_yellow];
            } else {
                cell.B_moneyLabel.textColor = [UIColor color_text_light_gray];
            }
            ///B_MoneyLabel 需要根据钱的正负来展示不同的颜色
            
            return cell;
        };
        _mainView.didSelectRow = ^(UITableView *tableView, NSIndexPath *indexPath) {
            
        };
        
    }
    return _mainView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
